<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Transliterate a string</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="transliterator.listids.html">Transliterator::listIDs</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.intlbreakiterator.html">IntlBreakIterator</a></div>
 <div class="up"><a href="class.transliterator.html">Transliterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="transliterator.transliterate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Transliterator::transliterate</h1>
  <h1 class="refname">transliterator_transliterate</h1>
  <p class="verinfo">(PHP &gt;= 5.4.0, PECL intl &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">Transliterator::transliterate</span> -- <span class="refname">transliterator_transliterate</span> &mdash; <span class="dc-title">Transliterate a string</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-transliterator.transliterate-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>Transliterator::transliterate</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$subject</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$start</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$end</code></span>
  ]] )</div>

  <p class="para rdfs-comment">过程化风格</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>transliterator_transliterate</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$transliterator</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$subject</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$start</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$end</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Transforms a string or part thereof using an ICU transliterator.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-transliterator.transliterate-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">transliterator</code></em></dt>

    <dd>

     <p class="para">
      In the procedural version, either a <a href="class.transliterator.html" class="classname">Transliterator</a>
      or a <span class="type"><a href="language.types.string.html" class="type string">string</a></span> from which a
      <a href="class.transliterator.html" class="classname">Transliterator</a> can be built.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">subject</code></em></dt>

    <dd>

     <p class="para">
      The string to be transformed.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">start</code></em></dt>

    <dd>

     <p class="para">
      The start index (in UTF-16 code units) from which the string will start
      to be transformed, inclusive. Indexing starts at 0. The text before will
      be left as is.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">end</code></em></dt>

    <dd>

     <p class="para">
      The end index (in UTF-16 code units) until which the string will be
      transformed, exclusive. Indexing starts at 0. The text after will be
      left as is.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-transliterator.transliterate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The transfomed string on success,  或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-transliterator.transliterate-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2612">
    <p><strong>Example #1 Converting escaped UTF-16 code units</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"\u304A\u65E9\u3046\u3054\u3056\u3044\u307E\u3059"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">transliterator_transliterate</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hex-Any/Java"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//now&nbsp;the&nbsp;reverse&nbsp;operation&nbsp;with&nbsp;a&nbsp;supplementary&nbsp;character<br /></span><span style="color: #0000BB">$supplChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">html_entity_decode</span><span style="color: #007700">(</span><span style="color: #DD0000">'&amp;#x1D11E;'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">mb_strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$supplChar</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$encSupplChar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">transliterator_transliterate</span><span style="color: #007700">(</span><span style="color: #DD0000">"Any-Hex/Java"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$supplChar</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//echoes&nbsp;two&nbsp;encoded&nbsp;UTF-16&nbsp;code&nbsp;units<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$encSupplChar</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//and&nbsp;back<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">transliterator_transliterate</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hex-Any/Java"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$encSupplChar</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

     <div class="example-contents"><p>以上例程的输出类似于：</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
お早うございます
1
\uD834\uDD1E
𝄞

</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-transliterator.transliterate-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="transliterator.geterrormessage.html" class="methodname" rel="rdfs-seeAlso">Transliterator::getErrorMessage()</a> - Get last error message</span></li>
    <li class="member"><span class="methodname"><a href="transliterator.construct.html" class="methodname" rel="rdfs-seeAlso">Transliterator::__construct()</a> - Private constructor to deny instantiation</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="transliterator.listids.html">Transliterator::listIDs</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.intlbreakiterator.html">IntlBreakIterator</a></div>
 <div class="up"><a href="class.transliterator.html">Transliterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
